package com.ruoyi.common.enums;

public enum ConsumeType {
    ALL(0, "全部"),
    UNBOXING(1, "开箱"),
    BATTLE(2, "对战"),
    LUCKY_ITEMS(3, "幸运饰品"),
    MINESWEEPER(4, "扫雷");

    private final Integer code;
    private final String description;

    ConsumeType(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据代码查找对应的选项
    public static ConsumeType getByCode(Integer code) {
        for (ConsumeType option : values()) {
            if (option.getCode().equals(code)) {
                return option;
            }
        }
        throw new IllegalArgumentException("Invalid Game Option code: " + code);
    }
}
